/******jquery.alert.js start******/
(function (a) {
	a.alerts = {
		verticalOffset: -75,
		horizontalOffset: 0,
		repositionOnResize: true,
		overlayOpacity: 0.01,
		overlayColor: "#FFF",
		draggable: true,
		okButton: "&nbsp;确定&nbsp;",
		cancelButton: "&nbsp;取消&nbsp;",
		dialogClass: null,
		alert: function (b, c, d) {
			if (c == null) {
				c = "Alert"
			}
			a.alerts._show(c, b, null, "jalert", function (e) {
				if (d) {
					d(e)
				}
			})
		},
		confirm: function (b, c, d) {
			if (c == null) {
				c = "Confirm"
			}
			a.alerts._show(c, b, null, "jconfirm", function (e) {
				if (d) {
					d(e)
				}
			})
		},
		prompt: function (b, c, d, e) {
			if (d == null) {
				d = "Prompt"
			}
			a.alerts._show(d, b, c, "jprompt", function (f) {
				if (e) {
					e(f)
				}
			})
		},
		information: function (b, c, d) {
			if (c == null) {
				c = "Information"
			}
			a.alerts._show(c, b, null, "jinformation", function (e) {
				if (d) {
					d(e)
				}
			})
		},
		_show: function (g, f, c, b, i) {
			a.alerts._hide();
			a.alerts._overlay("show");
			a("BODY").append('<div id="jalert_container" ><div id="jalert_close"></div><h1 id="jalert_title"></h1><div id="jalert-line"></div><div id="jalert_content"><div id="jalert_message"></div></div></div>');
			if (a.alerts.dialogClass) {
				a("#jalert_container").addClass(a.alerts.dialogClass)
			}
			// var h = (a.browser.msie && parseInt(a.browser.version) <= 6) ? "absolute" : "fixed";
			// 设置样式
			var h = "fixed";

			a("#jalert_container").css({
				position: h,
				zIndex: 99999,
				padding: 0,
				margin: 0
			});
			a("#jalert_title").text(g);
			a("#jalert_content").addClass(b);
			a("#jalert_message").text(f);
			a("#jalert_message").html(a("#jalert_message").text().replace(/\n/g, "<br />"));
			// a("#jalert_container").css({
			// 	minWidth: a("#jalert_container").outerWidth(),
			// 	maxWidth: a("#jalert_container").outerWidth()
			// });
			a('#jalert_close').click(function () {
				a.alerts._hide();
			});
			a.alerts._reposition();
			a.alerts._maintainPosition(true);
			switch (b) {
				case "jalert":
					a("#jalert_message").after('<div id="jalert_panel"><input type="button" value="' + a.alerts.okButton + '" id="jalert_ok" /></div>');
					a("#jalert_ok").click(function () {
						a.alerts._hide();
						if (i) {
							i(true)
						}
					});
					a("#jalert_ok").focus().keypress(function (j) {
						if (j.keyCode == 13 || j.keyCode == 27) {
							a("#jalert_ok").trigger("click")
						}
					});
					break;
				case "jconfirm":
					a("#jalert_message").after('<div id="jalert_panel"><input type="button" value="' + a.alerts.okButton + '" id="jalert_ok" /> <input type="button" value="' + a.alerts.cancelButton + '" id="jalert_cancel" /></div>');
					a("#jalert_ok").click(function () {
						a.alerts._hide();
						if (i) {
							i(true)
						}
					});
					a("#jalert_cancel").click(function () {
						a.alerts._hide();
						if (i) {
							i(false)
						}
					});
					a("#jalert_ok").focus();
					a("#jalert_ok, #jalert_cancel").keypress(function (j) {
						if (j.keyCode == 13) {
							a("#jalert_ok").trigger("click")
						}
						if (j.keyCode == 27) {
							a("#jalert_cancel").trigger("click")
						}
					});
					break;
				case "jprompt":
					a("#jalert_message").append('<br /><input type="text" size="30" id="jalert_prompt" />').after('<div id="jalert_panel"><input type="button" value="' + a.alerts.okButton + '" id="jalert_ok" /> <input type="button" value="' + a.alerts.cancelButton + '" id="jalert_cancel" /></div>');
					a("#jalert_prompt").width(a("#jalert_message").width());
					a("#jalert_ok").click(function () {
						var e = a("#jalert_prompt").val();
						a.alerts._hide();
						if (i) {
							i(e)
						}
					});
					a("#jalert_cancel").click(function () {
						a.alerts._hide();
						if (i) {
							i(null)
						}
					});
					a("#jalert_prompt, #jalert_ok, #jalert_cancel").keypress(function (j) {
						if (j.keyCode == 13) {
							a("#jalert_ok").trigger("click")
						}
						if (j.keyCode == 27) {
							a("#jalert_cancel").trigger("click")
						}
					});
					if (c) {
						a("#jalert_prompt").val(c)
					}
					a("#jalert_prompt").focus().select();
					break;
				case "jinformation":
					a("#jalert_message").after('<div id="jalert_panel"></div>');
					break
			}
			if (a.alerts.draggable) {
				try {
					a("#jalert_container").draggable({
						handle: a("#jalert_title")
					});
					a("#jalert_title").css({
						cursor: "move"
					})
				} catch (d) {
				}
			}
		},
		_hide: function () {
			a("#jalert_container").remove();
			a.alerts._overlay("hide");
			a.alerts._maintainPosition(false)
		},
		_overlay: function (b) {
			switch (b) {
				case "show":
					a.alerts._overlay("hide");
					a("BODY").append('<div id="jalert_overlay"></div>');
					a("#jalert_overlay").css({
						position: "absolute",
						zIndex: 99998,
						top: "0px",
						left: "0px",
						width: "100%",
						height: a(document).height(),
						background: a.alerts.overlayColor,
						opacity: a.alerts.overlayOpacity
					});
					break;
				case "hide":
					a("#jalert_overlay").remove();
					break
			}
		},
		_reposition: function () {
			var c = ((a(window).height() / 2) - (a("#jalert_container").outerHeight() / 2)) + a.alerts.verticalOffset;
			var b = ((a(window).width() / 2) - (a("#jalert_container").outerWidth() / 2)) + a.alerts.horizontalOffset;
			if (c < 0) {
				c = 0
			}
			if (b < 0) {
				b = 0
			}
			// if (a.browser.msie && parseInt(a.browser.version) <= 6) {
			// 	c = c + a(window).scrollTop()
			// }
			a("#jalert_container").css({
				top: c + "px",
				left: b + "px"
			});
			a("#jalert_overlay").height(a(document).height())
		},
		_maintainPosition: function (b) {
			if (a.alerts.repositionOnResize) {
				switch (b) {
					case true:
						a(window).bind("resize", a.alerts._reposition);
						break;
					case false:
						a(window).unbind("resize", a.alerts._reposition);
						break
				}
			}
		}
	};
	jAlert = function (b, c, d) {
		a.alerts.alert(b, c, d)
	};
	jConfirm = function (b, c, d) {
		a.alerts.confirm(b, c, d)
	};
	jPrompt = function (b, c, d, e) {
		a.alerts.prompt(b, c, d, e)
	};
	jInformation = function (b, c, d) {
		a.alerts.information(b, c, d)
	}
})(jQuery);
/******jquery.alert.js end******/

/******jquery.alert.js start 新的******/
/*
 新修改的弹出框：
 更新点：修改了传参数的方法，去掉了一些多余的方法
 
 使用方法：
 $.dialog({
 title:'温馨提示',
 html:'您的帐号已被锁定，请联系在线客服！',
 confirm:{
 name:'确认',
 callback:function(){}
 },
 hasOverlay:true,
 jumpUrl:'index.html'
 })
 */
(function ($) {
	$.dialog = function (options) {

		//默认的属性
		var defaults = {
			type: 'jalert', //弹出框类型，jalert(文本单按钮),jconfirm(文本双按钮),jpop(复杂类型)
			jumpUrl: 'javascript:void(0)', //按钮a标签的url
			title: '温馨提示', //title的内容
			html: '你好 我的名字叫弹出框', //弹出框中的内容
			repositionOnResize: true, //是否能调节大小
			draggable: true, //是否能拖拽
			hasOverlay: true, //是否显示遮罩层
			id: '', //弹出框id							
			confirm: {//确认操作
				name: "确定",
				callback: function () {}
			},
			cancel: {//取消操作
				name: "取消",
				callback: function () {}
			},
			closed: null, //关闭操作
			diycontent: false                     //是否有自定义内容


		};

		var settings = $.extend(true, defaults, options);

		var type = (settings.type).toLowerCase();
		var jumpUrl = settings.jumpUrl;
		var title = settings.title;
		var html = settings.html;
		var repositionOnResize = settings.repositionOnResize;
		var draggable = settings.draggable;
		var hasOverlay = settings.hasOverlay;
		var draggable = settings.draggable;
		var confirm = settings.confirm;
		var cancel = settings.cancel;
		var closed = settings.closed;
		var diycontent = settings.diycontent;
		var dialogId = settings.id;

		var dialog = {
			_dialogContainer: $('<div class="dialog_container dialog" id="' + dialogId + '"></div>'),
			_overlayContainer: $('<div class="dialog_overlay"></div>'),
			//初始化
			init: function () {
				var _this = this;
				_this._show();
			},
			//显示
			_show: function () {
				var _this = this;
				// 设置html
				var confirmHtml = '<a href="javascript:void(0)" class="dialog_ok dia_button">' + confirm.name + '</a>';
				var cancelHtml = '<a href="javascript:void(0)" class="dialog_cancel dia_button">' + cancel.name + '</a>';

				var btnshtml = '';
				if (type == 'jalert') {
					btnshtml += confirmHtml;
				} else if (type == 'jconfirm') {
					btnshtml += confirmHtml + cancelHtml;
				} else if (type == 'jpop') {
					btnshtml += '';
				}
				var dialogHtml = '';

				//判断是否要自定义内容
				if (type != 'jpop') {
					dialogHtml = '<a class="dialog_close" href="javascript:void(0)" data-url="' + settings.jumpUrl + '"></a>\
							<h1 class="dialog_title">' + title + '</h1>\
							<div id="jalert-line"></div>\
							<div class="dialog_content jalert">\
								<div class="content-wrap">' + html + '<div class="dialog_panel">' + btnshtml + '</div></div>\
							</div>';
				} else {
					dialogHtml = '<a class="dialog_close" href="javascript:void(0)" data-url="' + settings.jumpUrl + '"></a>\
							<h1 class="dialog_title">' + title + '</h1>\
							<div class="dialog_content jalert">\
								<div class="content-wrap">' + html + '</div>\
							</div>';
				}
				_this._dialogContainer.html(dialogHtml);
				$("body").append(_this._dialogContainer);

				//遮罩
				_this._overlay(hasOverlay);

				//设置样式
				var pos = "fixed";
				_this._dialogContainer.css({
					position: pos,
					zIndex: 99999
				});

				// 绑定事件
				_this._events();
				_this._reposition();
				_this._maintainPosition(true);
			},
			// var dialog = dialog();
			// dialog.close();
			//绑定事件
			_events: function () {
				var _this = this;
				_this.dialogclose = _this._dialogContainer.find(".dialog_close");
				_this.dialogconfirm = _this._dialogContainer.find(".dialog_ok");
				_this.dialogcancel = _this._dialogContainer.find(".dialog_cancel");

				_this.dialogclose.on("click", function () {
					_this._hide(closed);
				});

				_this.dialogconfirm.on("click", function () {
					_this._hide(confirm.callback);
				});

				_this.dialogcancel.on("click", function () {
					_this._hide(cancel.callback);
				});
				_this._overlayContainer.on("click", function () {
					_this._hide(closed);
				});

			},
			//隐藏
			_hide: function (callback) {
				var _this = this;
				_this._overlay(false);
				_this._dialogContainer.remove();
				typeof callback == 'function' && callback();
			},
			//遮罩
			_overlay: function (status) {
				var _this = this;
				switch (status) {
					case true:
						//只创建一次
						if ($('body').find('.dialog_overlay').length == 0) {
							$("body").append(_this._overlayContainer);
						}
						_this._overlayContainer.css({
							position: "absolute",
							zIndex: 99998,
							top: "0px",
							left: "0px",
							width: "100%",
							height: $(document).height(),
							background: '#000',
							opacity: 0.3
						});
						break;
					case false:
						_this._overlayContainer.remove();
						break;
				}
			},
			//定位
			_reposition: function () {
				var _this = this;
				var top = (($(window).height() / 2) - (dialog._dialogContainer.outerHeight() / 2));
				var left = (($(window).width() / 2) - (dialog._dialogContainer.outerWidth() / 2));
				if (top < 0) {
					top = 0
				}
				if (left < 0) {
					left = 0
				}
				dialog._dialogContainer.css({
					top: top + "px",
					left: left + "px"
				});
				dialog._overlayContainer.height($(document).height())
			},
			//改变窗口大小时重新定位
			_maintainPosition: function (status) {
				if (repositionOnResize) {
					switch (status) {
						case true:
							$(window).bind("resize", dialog._reposition);
							break;
						case false:
							$(window).unbind("resize", dialog._reposition);
							break;
					}
				}
			}
		}

		dialog.init();

	}
})(jQuery);
/******jquery.alert.js end 新的******/

/******dialog.js start 版本3******/
/*
 新修改的弹出框：
 更新点：修改为面向对象的写法，这样在外面调用方法更灵活
 
 使用方法：
 var win = new Window();
 win.init({
 title:'温馨提示',
 html:'您的帐号已被锁定，请联系在线客服！',
 confirm:{
 name:'确认',
 callback:function(){}
 },
 hasOverlay:true,
 jumpUrl:'index.html'
 });
 //关闭弹出框
 win.on('close');
 */
;
(function ($, window, document, undefined) {
	'use strict';

	function Window() {
		this.cfg = {
			type: 'jalert', //弹出框类型，jalert,jconfirm,jcommon
			width: 300, //弹出框的宽度
			height: 500, //弹出框的高度
			jumpUrl: 'javascript:void(0)', //按钮a标签的url
			title: '温馨提示', //title的内容
			html: '你好 我的名字叫弹出框', //弹出框中的内容
			hasCloseBtn: true,
			repositionOnResize: true, //是否能调节大小
			draggable: true, //是否能拖拽
			hasOverlay: true, //是否显示遮罩层
			id: '', //弹出框id							
			confirm: {//确认操作
				name: "确定",
				callback: function () {}
			},
			cancel: {//取消操作
				name: "取消",
				callback: function () {}
			},
			closed: null, //关闭操作
			disableOverlay: false, //点击遮罩是否能关闭弹出框

			isShow: true, //弹出框初始化是否显示，默认显示
			dialogparams: {}, //传参数给dialog
			isFix: false                     //是否固定宽高
		};
	}
	Window.prototype = {
		//创建弹出框
		render: function (container) {
			this.renderUI();
			this.handlers = {};
			this.bindUI();
			this.syncUI();
			// $(container || document.body).append(this.boundingBox);
		},
		//销毁弹出框
		destroy: function () {
			this.destructor();
			this.boundingBox.off();
			this.boundingBox.remove();
		},
		renderUI: function () {
			//*****************拼装DOM*****************
			var footerContent = '';
			switch (this.cfg.type) {
				case 'jalert':
					footerContent = '<a href="javascript:void(0)" class="dialog_ok dia_button window_confirmBtn">' + this.cfg.confirm.name + '</a>';
					break;
				case 'jconfirm':
					footerContent = '<a href="javascript:void(0)" class="dialog_ok dia_button window_confirmBtn">' + this.cfg.confirm.name + '</a><a href="javascript:void(0)" class="dialog_cancel dia_button window_cancelBtn">' + this.cfg.cancel.name + '</a>';
					break;
			}

			this.boundingBox = $(
					'<div class="dialog_container dialog" id="' + this.cfg.id + '">' +
					'<div class="dialog_content">' + this.cfg.html + '</div>' +
					'</div>'
					);
			this.boundingBox.css({
				position: 'fixed',
				zIndex: 99998,
				padding: 0,
				margin: 0
			});


			if (this.cfg.type !== 'jcommon') {
				this.boundingBox.prepend('<div class="dialog_title">' + this.cfg.title + '</div>');
				if (this.cfg.type != 'jpop') {
					this.boundingBox.append('<div class="dialog_panel">' + footerContent + '</div>');
				}
			}


			if (this.cfg.hasOverlay) {
				this._mask = $('<div class="dialog_overlay"></div>');
				this._mask.appendTo('body');
			}
			if (this.cfg.hasCloseBtn) {
				var closeBtn = $('<a class="dialog_close" href="javascript:void(0)" data-url="' + this.cfg.jumpUrl + '"></a>');
				this.boundingBox.append(closeBtn);
			}
			this.boundingBox.appendTo($('body'));
			//*****************对DOM进行操作*****************
			//提示语是否显示
			if (this.params('prompt')) {
				$('.dialogprompt').show();
			} else {
				$('.dialogprompt').hide();
			}
		},
		bindUI: function () {
			var that = this;
			this.boundingBox.delegate('.dialog_ok', 'click', function () {
				that.fire('confirm');
				that.destroy();
			}).delegate('.dialog_cancel', 'click', function () {
				that.fire('cancel');
				that.destroy();
			}).delegate('.dialog_close', 'click', function () {
				that.fire('close');
				that.destroy();
			});

			if (!this.cfg.disableOverlay) {
				this._mask.on('click', function () {
					that.fire('close');
					that.destroy();
				});
			}


			if (typeof this.cfg.confirm.callback == 'function') {
				this.on('confirm', this.cfg.confirm.callback);
			}

			if (typeof this.cfg.closed == 'function') {
				this.on('close', this.cfg.closed);
			}

			if (typeof this.cfg.cancel.callback == 'function') {
				this.on('cancel', this.cfg.cancel.callback);
			}
		},
		syncUI: function () {
			//遮罩
			this._overlay();
			//弹出框
			if (!this.cfg.isShow) {
				this.boundingBox.css({
					display: 'none'
				});
			}
			//是否固定宽高
			if (this.cfg.isFix) {
				this.boundingBox.css({
					width: this.cfg.width,
					height: this.cfg.height
				});
			}

			this.position();
			this.respostion();
			if (this.cfg.skinClassName) {
				this.boundingBox.addClass(this.cfg.skinClassName);
			}
		},
		//遮罩
		_overlay: function (status) {
			this._mask.css({
				position: "absolute",
				zIndex: 99997,
				top: "0px",
				left: "0px",
				width: "100%",
				height: $(document).height(),
				background: '#000',
				opacity: 0.3
			});
		},
		//弹出框销毁前执行的事件
		destructor: function () {
			this._mask && this._mask.remove();
		},
		//设置弹出框的位置
		position: function (n1, n2) {
			var that = this;
			this.boundingBox.css({
				left: (($(window).width() - this.boundingBox.outerWidth()) / 2) + 'px',
				top: (($(window).height() - this.boundingBox.outerHeight()) / 2) + 'px'
			});
		},
		respostion: function () {
			var that = this;
			//$.proxy改变this指向
			$(window).on('resize', $.proxy(that.position, that));
		},
		//入口方法
		init: function (cfg) {
			$.extend(true, this.cfg, cfg);
			this.render();
			return this;
		},
		close: function () {
			this.destroy();
		},
		//获取和设置，传给弹出框的参数
		params: function (key, val) {
			if (!this.isEmptyObject(this.cfg.dialogparams)) {
				if (typeof val != 'undefined') {
					this.cfg.dialogparams[key] = val;
				} else {
					return this.cfg.dialogparams[key];
				}
			}
		},
		//***************************组件公共方法***************************
		isEmptyObject: function (obj) {
			for (var key in obj) {
				return false;
			}
			return true;
		},
		// 非常经典的观察则模式实现
		//事件绑定
		on: function (type, handler) {
			if (typeof this.handlers[type] === 'undefined') {
				this.handlers[type] = [];
			}
			this.handlers[type].push(handler);
			return this;
		},
		//事件触发
		fire: function (type, data) {
			if (this.handlers[type] instanceof Array) {
				var handlers = this.handlers[type];
				for (var i = 0, len = handlers.length; i < len; i++) {
					handlers[i](data);
				}
				// this.handlers[type] = []; // 此处有bug，会多次触发alert事件
			}
		}
	};
	Window.prototype.constructor = Window;

	window.Window = Window;
})(jQuery, window, document);
/******dialog.js end 版本3******/



;
!function (global, $, undefined) {
	if (global.prj) {
		return
	}
	global.prj = prj = {};
	prj.pop = function ($cont, $type, $url, $timecount, $tourl) {
		var curloca = window.location.href;//新加获取当前网址 03.15
		if ($type == "1") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示<a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='" + $url + "' class='bttn2'>确定</a></div></div><div id='popmask' class='popmask'></div>")
		} else if ($type == "2") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con pop-con-whz'><div class='pop-con-top'>温馨提示  <a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='javascript:void(0)' class='bttn-whz'>确定</a></div></div><div id='popmask' class='popmask'></div>")
			$(".bttn-whz").bind("click", function () {
				$("#popmask").css("display", "none");
				$(".pop-con-whz").css("display", "none");
			})
		} else if ($type == "11") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con new-pop-con'><div class='pop-con-top'>温馨提示  <a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='" + $url + "' class='bttn2'>确定</a></div></div><div id='popmask' class='popmask'></div>")
		} else if ($type == "3") {//带 忘记密码？的弹窗
			prj.popmove();
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示 <a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='javascript:void(0);' class='bttn close'>确定</a><a class='login_forpwd' target='_blank' href='getpassword.htm'>忘记密码?</a></div></div><div id='popmask' class='popmask'></div>")
		} else if ($type == "4") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con pop-con1'><div class='pop-con-top'>温馨提示 <a class='close closefresh' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='userchoosebank.htm' class='bttn ' style='width:180px;left:140px;'>立即存款，进行游戏</a></div></div><div id='popmask' class='popmask'></div>")
			$(".closefresh").click(function () {
				window.location.reload();
			});
		} else if ($type == "5") {//点击确定刷新页面
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示  <a class='close closefresh' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='javascript:void(0);' id='popclosebtn' class='bttn close closefresh'>确定</a></div></div><div id='popmask' class='popmask'></div>")
			$(".closefresh").click(function () {
				window.location.reload();
			});
		} else if ($type == "6") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示  <a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='" + $url + "' class='bttn'>确定</a></div></div><div id='popmask' class='popmask'></div>")
		} else if ($type == "7") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示<a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><div class='nosurpBox clearfix'><a href='#' class='bttn nosurp-close nosurp-btn'>立即返回</a><a href='javascript:void(0);' class='bttn nosurp-btn popRegy'>注册</a></div></div></div><div id='popmask' class='popmask'></div>")
		} else if ($type == "ie_version") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示<a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><div class='nosurpBox clearfix'><a href='"+ $url +"' class='bttn close' target='_blank'>立即下载</a></div></div></div><div id='popmask' class='popmask'></div>")
		}else if ($type == "8") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>恭喜您！<a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='" + $url + "' class='bttn'>确定</a></div></div><div id='popmask' class='popmask'></div>")
		} else if ($type == "pop_phonedown") {
			$("#E03-header").before("<div class='pop-con phone-pop-con'><div class='pop-con-top'>客户端下载  <a class='close' href='javascript:void(0);'></a></div><div class='pop-con-mid pop-con-mid-phone'><div class='phone-con'><div class='agqj_phone popphone_div'><b>AG旗舰</b></div><div class='aggj_phone popphone_div'><b>AG国际</b></div><div class='pt_phone popphone_div'><b>PT电子游艺</b></div></div><a href='javascript:void(0);' id='popclosebtn' class='bttn phone-bttn close'>确定</a></div></div><div id='popmask' class='popmask'></div>")
		} else if ($type == "9") {
			prj.popmove();
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示  <a class='close'  href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='javascript:void(0);' id='popclosebtn' class='bttn close'>确定</a></div></div><div id='popmask' class='popmask'></div>")
		} else if ($type == "tl") { //todo:AG电投
			prj.popmove();
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示  <a class='close' id='tl_close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a   href='javascript:void(0)' id='popclosebtn' class='bttn close' >进入AG电投</a><a   href='javascript:window.location.reload();' id='popclosebtn' class='bttn close' >继续完善资料</a></div></div><div id='popmask' class='popmask'></div>");
			$("#popclosebtn").bind("click", function () {
				prj.popgamein('E03036');
				window.location.reload();
			})
			$("#tl_close").click(function () {
				window.location.reload();
			})
		} else {
			$("#E03-header").before("<div class='pop-con'><div class='pop-con-top'>温馨提示  <a class='close' href='javascript:void(0);'></a></div><div class='pop-line'></div><div class='pop-con-mid'><div class='si-con'>" + $cont + "</div><a href='javascript:void(0);' id='popclosebtn' class='bttn close'>确定</a></div></div><div id='popmask' class='popmask'></div>")
		}
		/* 选中弹窗任意区域关闭弹窗 */
		winOutClose('.popmask', '.pop-con-whz', '.close');
		jQuery('#popwindow').css({'width': $(window).width(), 'height': $(document).height()});
		$(".pop-con").css("left", parseInt($(window).width()) / 2 - parseInt($(".pop-con").css("width")) / 2);
		$(".pop-con").css("top", parseInt($(window).height()) / 2 - parseInt($(".pop-con").css("height")) / 1);
		var $nosrpClose = $("#popmask").add(".pop-con");
		$(".pop-con a.popRegy").click(function () {
			$nosrpClose.hide();
			window.location.href = "registeruser.htm";

		})
		$(".nosurp-close").click(function (e) {
			$nosrpClose.hide();
		});
		$(".sure").click(function () {
			prj.popmove();
		});
		$(".close").click(function () {
			prj.popmove();
		});
		$(".popwindow").click(function () {
			prj.popmove();
		});
	}
	prj.divcenter = function ($id) {
		$("#" + $id).css("left", parseInt($(window).width()) / 2 - parseInt($("#" + $id).css("width")) / 2);
		$("#" + $id).css("top", parseInt($(window).height()) / 2 - parseInt($("#" + $id).css("height")) / 2);
	}
	prj.gotourl = function ($url) {
		openTryWindow(url, screen.availWidth - 15, screen.availHeight - 65);

		function openTryWindow(url, width, height) {
			var hasScroll = "yes";
			var param = "height=" + height + ", width=" + width + ", scrollbars= " + hasScroll + ",resizable=yes,toolbar=no,directories=no,menubar=no,locationbar=no,personalbar=no,statusbar=no";
			window.open(url, "_blank", param);
		}
	}
	//打开试玩弹出框
	prj.popvisit = function ($url, $gameid, $nsize, $gameType) {
		var static_content_prefix = '';
		var default_captcha_address='';
		var _globalHiddens = $('#js-global-hiddens');
		if (prj.getHiddenValues(_globalHiddens)) {
			static_content_prefix = prj.getHiddenValues(_globalHiddens).static_content_prefix;
			default_captcha_address =prj.getHiddenValues(_globalHiddens).default_captcha_address;
		}
		prj.loading(static_content_prefix + '/_default/__static/__images/load-f1.gif');
        var verifcode;
        tool.ajax({
                type: 'POST',
                url: "verifcodejson.htm",
                data: {"demo": "true"},
                success: function (data) {
                	prj.loadingcancel();
                    if(data.code=="true"){
                    	var html_win = '<div id="window-verifyBox" class="window-freePlay borderaius6">\
				                            <div class="window-cont">\
				                                <h3>请您输入验证码</h3>\
				                                <div class="freePlayBox clearfix"><input class="input4 fl borderaius4 inp input_verify" name="popcaptcha" id="input_verify" type="text"><img class="img_freecode" src="'+default_captcha_address+'" onclick="refreshCaptcha(this,'+default_captcha_address+')"/></div>\
				                                <a class="startPlay borderaius4" id="btn_verifycode" href="javascript:void(0);">立即试玩</a>\
				                            </div>\
				                             <div class="window-bot"><a target="_blank" href="registeruser.htm"></a></div>\
				                        </div>';

                        $.dialog({
                            type:'jpop',
                            id:'freeVerifyBox',
                            title:'需输入验证码',
                            html:html_win
                        })
                        $("#freeVerifyBox a#btn_verifycode").on("click",function(){
                            var _val = $("input#input_verify").val();
                            checknewdodemo(_val);
                        })
                    }else if(data.code=="false"){
                       checknewdodemo();
                    }
                },
                error:function(data){
                	prj.loadingcancel();
                	$.dialog({
                		html:'系统错误，请稍后重试'
                	})
                }
        })
        function checknewdodemo(){
            var freecode = arguments[0];
             prj.loading(static_content_prefix + '/_default/__static/__images/load-f1.gif');
        	 tool.ajax({
                type: 'POST',
                url: "new_dodemo.htm",
                data: {"demo": "true","freecode":freecode},
                success: function (data) {
                    if (data.status == 1) {
                        prj.popgamein($gameid,"",freecode);
                        window.location.href = "index.htm";
                    } else if (data.status == 3) {
                        $.dialog({
                            html: '验证码错误'
                        })
                    } else {
                        $.dialog({
                            html: '创建用户失败,请联系在线客服'
                        })
                    }
                    prj.loadingcancel();
                },
                error: function (data) {
                    if (data.responseText.substr(0, 6) == '201726') {
                        prj.pop("非常抱歉，相同IP下申请试玩次数已达到上限，请联系客服咨询");
                    } else {
                        prj.pop("非常抱歉，相同IP下申请试玩次数已达到上限，请联系客服咨询");
                    }
                    // console.log(data.responseText.substr(0,6));
                    prj.loadingcancel();
                }
            });
        }
		function openTryWindow(url, width, height) {
			var hasScroll = "yes";
			var param = "height=" + height + ", width=" + width + ", scrollbars= " + hasScroll + ",resizable=yes,toolbar=no,directories=no,menubar=no,locationbar=no,personalbar=no,statusbar=no";
			window.open(url, "_blank", param);
		}
	}
	//打开游戏
	prj.popgamein = function ($gameid, $gameType){

        if(iscode=="true" && arguments[3]!=true && arguments[2] == undefined){
            var default_captcha_address='';
            var _globalHiddens = $('#js-global-hiddens');
            if (prj.getHiddenValues(_globalHiddens)) {
                static_content_prefix = prj.getHiddenValues(_globalHiddens).static_content_prefix;
                default_captcha_address = prj.getHiddenValues(_globalHiddens).default_captcha_address;
            }
            var html_win = '<div id="window-verifyBox" class="window-freePlay borderaius6">\
				                            <div class="window-cont">\
				                                <h3>请您输入验证码</h3>\
				                                <div class="freePlayBox clearfix"><input class="input4 fl borderaius4 inp input_verify" name="popcaptcha" id="input_verify" type="text"><img class="img_freecode" src="'+default_captcha_address+'" onclick="refreshCaptcha(this,'+default_captcha_address+')"/></div>\
				                                <a class="startPlay borderaius4" id="btn_verifycode" href="javascript:void(0);">立即试玩</a>\
				                            </div>\
				                             <div class="window-bot"><a target="_blank" href="registeruser.htm"></a></div>\
				                        </div>';

            $.dialog({
                type:'jpop',
                id:'freeVerifyBox',
                title:'需输入验证码',
                html:html_win
            })

            $("#freeVerifyBox a#btn_verifycode").on("click",function(){
                // checknewdodemo();
                var _val = $("input#input_verify").val();
                window.location.href = "index.htm";
                prj.popgamein($gameid,$gameType,_val,true);
            })
            return;
        }
        var code = "";
        if(arguments[2] != undefined){
            code  ="&freecode="+arguments[2];
        }
		if ($gameType != undefined && $gameType != "") {
			openWindow('loginGame.htm?gameCode=' + $gameid + '&gameType=' + $gameType + code, screen.availWidth - 15, screen.availHeight - 65);
		} else {
			openWindow('loginGame.htm?gameCode=' + $gameid + code, screen.availWidth - 15, screen.availHeight - 65);
		}

		function openWindow(url, width, height) {

			var map = new ParamsMap();
			var result = undefined;
			var hasScroll = "yes";
			var param = "height=" + height + ", width=" + width + ", scrollbars= " + hasScroll + ",resizable=yes,toolbar=no,directories=no,menubar=no,locationbar=no,personalbar=no,statusbar=no";
			window.open(url, "_blank", param);
			/*   sendAjaxRequest("checkLoginDetails.htm", map, function(results){
			 if (results.isLogin != "false"){
			 var hasScroll = "yes";
			 var param = "height=" +  height + ", width=" + width +", scrollbars= " + hasScroll + ",resizable=yes,toolbar=no,directories=no,menubar=no,locationbar=no,personalbar=no,statusbar=no";		
			 window.open(url,"_blank",param);	
			 }else{
			 prj.pop("尊敬的会员，您的登陆已超时，请您重新登陆！","4",'',6,'index.htm');
			 }
			 },false);	*/
		}
	}
	//关闭弹出框
	prj.popmove = function () {
		$(".pop-con").remove();
		$(".popmask").remove();
		$("#popwindow").empty().hide();
	}
	//表单的正确错误提示
	prj.formmsg = function ($id, $warnid, $warnwords, $flag) {
		//正确
		if ($flag == 1) {
			$("#" + $warnid).html($warnwords).hide();
			$("#" + $id).closest('.txt_div').removeClass('txt_wrong').addClass("txt_right");
			$("#" + $id).closest('.txt_div').find(".txt_in").css("border-color", "green");
			$("#" + $id).closest('.txt_div').find("em").removeClass('icon-cuo').addClass('icon-iconfont22').show();
		} else if ($flag == 2) {
			$("#" + $warnid).html($warnwords).hide();
			$("#" + $id).parent().removeClass('txt_wrong').addClass("txt_right");
			$("#" + $id).parent().find(".txt_in").css("border-color", "#dedede");
			$("#" + $id).parent().find("em").removeClass('icon-cuo').addClass('icon-iconfont22');
		} else if ($flag == 3) {
			$("#" + $warnid).removeClass("randt-lbl4").addClass("randt-lbl3").addClass("warnred").html($warnwords);
			$("#" + $id).parent().find(".msgimg").addClass('msgimgW').show();
		} else if ($flag == 9) {
			$("." + $id).find("span").find("#" + $warnid).text($warnwords).css("color", "#fff").siblings().css("color", "#02d8ff");
			$("#" + $warnid).closest("span").siblings("input").css("background-color", "#fff");
			$("#" + $warnid).closest("span").css("color", "#fff").find("i").text("*")
		} else if ($flag == 8) {
			$("#" + $warnid).closest("span").find("b").text("通过").css("color", "#fff");
			$("#" + $warnid).closest("span").find("i").text("√").css("color", "#8bdf14");
		} else if ($flag == 0) {
			$("#" + $warnid).html($warnwords).show();
			$("#" + $id).parent().removeClass('txt_right txt_wrong');
			$("#" + $id).parent().find(".txt_in").removeAttr("style");
			$("#" + $id).parent().find("em").removeClass().addClass('iconfont').hide();
			$("#" + $id).parent().find("em").removeClass('icon-cuo icon-iconfont22');
		}else if($flag == 6){
	   		//只有提示语，没有对应的input
	   		$("#"+$warnid).html($warnwords).show();
	    }else {
			//错误	
			$("#" + $warnid).html($warnwords).show();
			// $("#"+$id).parent().removeClass('txt_right').addClass('txt_wrong');
			$("#" + $id).closest('.txt_div').removeClass('txt_right').addClass('txt_wrong');
			$("#" + $id).closest('.txt_div').find(".txt_in").css("border-color", "#ff2c00");
			$("#" + $id).closest('.txt_div').find("em").removeClass('icon-iconfont22').addClass('icon-cuo').show();
		}
	}
	//打开在线聊天
	prj.openOnlineChat = function () {
		var infoValue = '&info='+$("#tomInfoValue").val();
		var enterurl = '&enterurl='+encodeURIComponent(window.location.href);
		var param = infoValue+enterurl;
		var url = 'https://www.f66-kefu.com/chat/chatClient/chatbox.jsp?companyID=8996&configID=3'+param;
		
		
		var left = (screen.width / 2) - (600 / 2);
		var top = (screen.height / 2) - (400 / 2);
		// window.open(url,"DescriptiveWindowName","resizable,scrollbars=yes,status=1,width=600, height=400, top="+top+", left="+left);
		window.open(url, "DescriptiveWindowName");
	}

	//loading
	prj.loading = function (supflashAddress, normalflashAddress, hasMask) {
		if ($('div.popWrap').length < 1) {
			//loading图标的显示
			$(".ns_container").prepend('<div id="loadingpop"><div class="popWrap"><img src="' + supflashAddress + '" id="loadingImg"/></div></div>');
			$("#loadingpop").css("left", parseInt($(window).width()) / 2 - 70);
			$("#loadingpop").css("top", parseInt($(window).height()) / 2 - 80);
			//遮罩的显示
			if (hasMask != 'undefined' && !hasMask) {
				if ($('.masktop_opacity').length == 0) {
					$(".ns_container").prepend('<div class="masktop_opacity"></div>');
				}
				$('.masktop_opacity').css('opacity', 0);
			}
			$('.masktop_opacity').show();
		}
		;
	}
	prj.loadingcancel = function () {
		$('.masktop_opacity').hide();
		$("#loadingpop").remove();
	}
	//透明度为0的遮罩
	prj.newloading = function (hasMask) {
		var masktop = $('.masktop_opacity');
		if ($('.masktop_opacity').length == 0) {
			$("body").prepend('<div class="masktop_opacity"></div>');
		}
		$('.masktop_opacity').show().css('opacity', 0);
	}
	//指定区域loading的效果
	prj.partloading = function (container) {
		var pageLoading = $(container).find('.pageLoading');
		if(pageLoading.length == 0){
			$(container).append('<div class="pageLoading"><span class="loading"><span class="loading-word">加载中</span></span></div>');
		}
		//loading效果
		tool.loadingAnimation($('.pageLoading .loading'));
	}
	//指定区域loading的取消
	prj.partloadingcancel = function (container) {
		var pageloading = $(container).find('.pageLoading');
		$(pageloading).hide(function () {
			$(this).remove();
		});
	}
	/*
	 功能：按钮处的loading效果
	 参数：
	 btn:按钮容器
	 
	 注意：
	 ①不能修改btnloading这个class，因为都是根据这个操作的
	 
	 */
	prj.btnloading = function (btn, loadingword) {
		var loadingword = typeof loadingword == 'undefined' ? '提交中' : loadingword;
		//复制一个副本
		var cloneBtn = btn.clone(true);

		/*
		 按钮克隆，需要单例
		 */
		btn.hide();
		btn.siblings('.btnloading').remove();
		cloneBtn.insertAfter(btn);
		cloneBtn.addClass('disable btnloading').html(loadingword);
		//loading效果
		tool.loadingAnimation(cloneBtn);

		//透明度为0的遮罩
		this.newloading();
	}
	/*
	 功能：去掉按钮上的loading效果
	 参数：
	 btn:按钮容器
	 注意：
	 ①不能修改btnloading这个class，因为都是根据这个操作的
	 */
	prj.btnloadingcancel = function (btn) {
		$(btn).show().siblings('.btnloading').remove();
		//透明度遮罩
		this.loadingcancel();
	}
	prj.rotate = function () {
		$("#loadingImg").rotate({
			angle: 0,
			animateTo: 360,
			callback: this.rotate,
			easing: function (x, t, b, c, d) {
				return c * (t / d) + b;
			}
		});
	}
	/*
	 功能：获取隐藏域中的参数
	 参数：
	 selector:存放隐藏域的容器
	 使用方法：
	 <div id="js-local-hidden">这个selector自己写
	 <input type="hidden" value="{{phone}}" name="phone"/>
	 </div>
	 返回值：json对象
	 {phone:123}		
	 */
	prj.getHiddenValues = function (selector) {
		var res = {};
		var container = $(selector);
		container.find('input[type=hidden]').each(function (i, input) {
			var $input = $(input);
			res[$input.attr('name')] = $input.val();
		});
		container.find('textarea').each(function (i, input) {
			var $input = $(input);
			res[$input.attr('name')] = $.parseJSON($input.val());
		});
		return res;
	}

	/*
	 功能：通用登录方法
	 参数：
	 jumpType:
	 1:登录后跳转到游戏主页
	 0:登录后在当页刷新
	 obj：
	 包含登录密码和密码的input框
	 默认：$("#login-name")，$("#login-password")
	 
	 loginname-登录名
	 loginpsw-登录密码
	 
	 */
	// 登录弹出框按钮部分
	var loginDialog = '<div class="dialog_panel"><a href="javascript:void(0)" class="dialog_ok button">确认</a></div><a class="login_forpwd" target="_blank" href="getpassword.htm">忘记密码?</a>';
	prj.login = function (options) {
		//账号，密码的容器
		var defaults = {
			loginname: $("#login-name"), //登录姓名节点 
			loginpsw: $("#login-password"), //登录密码节点
			loginbtn: $("#loginBtn"), //登录触发按钮	
			msgtype: 'dialog', //登录的提示类型,dialog:弹出框,form:直接在表单中显示
			jumpType: 1                           //判断跳转类型，当页刷新还是跳转到其他页面
		}
		var settings = $.extend(true, defaults, options);

		var loginname = settings.loginname;
		var loginpsw = settings.loginpsw;
		var loginbtn = settings.loginbtn;
		var msgtype = settings.msgtype;
		var jumpType = settings.jumpType;

		//若节点不存在
		if (!loginname || !loginpsw) {
			return;
		}

		var static_content_prefix = '';
		var thisLocation = window.location.href;
		var name = $(loginname).val();
		var pwd = $(loginpsw).val();
		/*
		 验证规则
		 */
		$.when(validModule.checkaccountname({val: name, msgtype: 'dialog'})).done(function (data) {
			if (!data || data == 2) {
				return false;
			} else if (!validModule.checkpassword({val: pwd, msgtype: 'dialog'})) {
				return false;
			} else {
				/*
				 提交表单
				 */
				tool.ajax({
					type: 'post',
					url: 'doLogin.htm',
					data: {'username': "v" + name, 'password': pwd},
					controlBtn: loginbtn,
					loadingtxt: '登录中',
					isAutoCancel: false,
					success: function (data) {
						//公共的回调处理
						if (data.isLoginSucc == 1) {
							if (jumpType == 1) {
								//if(data.isUpdateSucc== 1 ){	
								//          // prj.pop("系统检测到您的账户已经超过1个月未进行登录，为了您的账户和资金安全，请您修改登录密码。",11,"modifyExpiredPwd.htm");
								//          // jAlert("系统检测到您的账户已经超过1个月未进行登录，为了您的账户和资金安全，请您修改登录密码。",'温馨提示',null,{alinkUrl:"modifyExpiredPwd.htm"});
								// 			$.dialog({
								//     html:"系统检测到您的账户已经超过1个月未进行登录，为了您的账户和资金安全，请您修改登录密码。"+loginDialog,
								//     jumpUrl:"modifyExpiredPwd.htm"
								// });
								//      }else{
								//          if(data.tz!=false){
								//              window.location.href=data.tz;
								//          }else{
								//              window.location.href='casino.htm';
								//          }
								//      }
								if (data.tz != false) {
									window.location.href = data.tz;
								} else {
									window.location.href = 'casino.htm';
								}
							} else {
								window.location.href = thisLocation;
							}
						} else if (data.isLoginSucc == 0) {
							prj.btnloadingcancel(loginbtn);
							// prj.pop("您输入的账号或密码不正确,请重新输入!","3");
							// jAlert("您输入的账号或密码不正确,请重新输入!",'温馨提示');
							$.dialog({
								html: "您输入的账号或密码不正确,请重新输入!" + loginDialog,
								type: 'jpop'
							});
						} else if (data.isLoginSucc == "lock") {
							prj.btnloadingcancel(loginbtn);
							// prj.pop("您的账号已经被锁定5分钟,请联系在线客服进行解锁!","3");
							// jAlert("您的账号已经被锁定5分钟,请联系在线客服进行解锁!",'温馨提示');
							$.dialog({
								html: "您的账号已经被锁定5分钟,请联系<a href='javascript:void(0)' onclick='javascript:prj.openOnlineChat();' style='text-decoration:underline'>在线客服</a>进行解锁!" + loginDialog,
								type: 'jpop'
							});
						} else if (data.isLoginSucc == "lock2") {
							prj.btnloadingcancel(loginbtn);
							$.dialog({
								html: "您输入的账号登录异常，请您联系<a href='javascript:void(0)' onclick='javascript:prj.openOnlineChat();' style='text-decoration:underline'>在线客服</a>！" + loginDialog,
								type: 'jpop'
							});
						} else if (data.isLoginSucc == 2) {
							window.location.href = 'modifyExpiredPwd.htm';
						} else if (data.isLoginSucc == 5) {
							if (jumpType == 1) {
								if (data.tz != false) {
									window.location.href = data.tz;
								} else {
									window.location.href = 'casino.htm';
								}
							} else {
								window.location.href = thisLocation;
							}
							//prj.pop("尊敬的VIP会员，登录{{$vipWebsite}}，游戏更稳定，还有专属VIP优惠及贴心服务等着您！","4",'{{$vipWebsite}}',6,'playhall.htm?param=1');
						} else if (data.isLoginSucc == 999) {
							prj.btnloadingcancel(loginbtn);
							// prj.pop("登录有误，请联系客服");
							// jAlert("登录有误，请联系客服",'温馨提示');
							$.dialog({
								html: "登录有误，请联系客服" + loginDialog,
								type: 'jpop'
							});
						} else if (data.isLoginSucc == 9) {
							prj.btnloadingcancel(loginbtn);
							// prj.pop("登录有误，请联系客服");
							// jAlert("登录有误，请联系客服",'温馨提示');
							$.dialog({
								html: "密码错误，请重新填写密码" + loginDialog,
								type: 'jpop'
							});
						} else {
							var d = $.parseJSON(data);
							if (d.isLoginSucc == 99) {
								// jAlert('您已登录,请不要重复登录！',['温馨提示'],function() {
								//     window.location.reload();
								//     return false;
								// });
								$.dialog({
									html: "您已登录,请不要重复登录！" + loginDialog,
									type: 'jpop',
									confirm: {
										callback: function () {
											window.location.reload();
											return false;
										}
									}
								});
							} else {
								prj.btnloadingcancel(loginbtn);
								// $('#loginValidInput').blur();
								// jAlert("很抱歉，服务器内部错误，请稍后再试或者联系在线客服"+data.isLoginSucc,'温馨提示');
								$.dialog({
									html: "很抱歉，服务器内部错误，请稍后再试或者联系在线客服" + data.isLoginSucc + loginDialog,
									type: 'jpop'
								});
								// prj.pop("很抱歉，服务器内部错误，请稍后再试或者联系在线客服"+data.isLoginSucc);
							}
						}


					},
					error: function (data) {
						// jAlert(data,['温馨提示']);
						$.dialog({
							html: data + loginDialog,
							type: 'jpop'
						});
						prj.btnloadingcancel(loginbtn);
					}
				});
			}
		});
	}
	// 手机登录方法
	prj.phone_login = function (options) {
		var logphoneVal = $("#logphone").val();
		var phcodeVal = $("#ph_code").val();
		var loginbtn = $("#phone_loginBtn");
		//=============================================================
		//在此验证手机号码存在与否 不存在0 >>去注册; 存在1>>去登录  
		//=============================================================
		$.when(validModule.registphone({val: logphoneVal, validtype: 'reg'})).done(function (data) {
			if (data.num == 0) {
				var btn = loginbtn;
				var params = {'action': 'new_smsRegUser', 'phone': logphoneVal, 'smsCode': phcodeVal};
				tool.ajax({
					type: 'POST',
					url: "registeruser.htm", //注册接口
					data: params,
					controlBtn: btn,
					loadingtxt: '提交中',
					isAutoCancel: false,
					success: function (res) {
						//注册成功
						if (res.status == 1) {
							window.location.href = "userregSuccess.htm";
						}else if (res.status == 0) {
							$.dialog({
								html: res.mes
							});
							$("#ph_code").val("");
							prj.btnloadingcancel(btn);
						}

					},
					error: function (res) {
						//请求出问题
						// prj.btnloadingcancel(btn);
					}
				});
				
			}else {
				tool.ajax({
					type: 'post',
					url: 'userLoginBySms.htm',
					data: {'phone': logphoneVal, 'smsCode': phcodeVal},
					controlBtn: loginbtn,
					loadingtxt: '登录中',
					isAutoCancel: false,
					success: function (res) {
						if (res.status == 1) {
							//登录成功
							window.location.href = "casino.htm";
						} else if (res.status == 0) {
							$.dialog({
								html: res.mes
							});
							prj.btnloadingcancel(loginbtn);
						}
					},
					error: function (res) {
						// jAlert(data,['温馨提示']);
						$.dialog({
							html: '网络异常，请重试'
						});
						prj.btnloadingcancel(loginbtn);
					}
				});
			}
		});
		

	}
	/*
	 功能：通用注册方法
	 参数：
	 注册按钮
	 */
	prj.register = function (submit_btn) {
		register.init(submit_btn);
	}
	prj.phone_register = function (submit_btn) {
		phone_register.init(submit_btn);
	}
	prj.ieEbet = function(){
		var isIE = !!document.all;
		if(isIE){
			$('.ebet-play').attr({
				href: 'javascript:void(0);',
				target: '',
				onClick: ''
			}).click(function(){
				prj.pop('非常抱歉，您的浏览器版本较低，升级到IE11即可参与游戏；或请您使用谷歌浏览器、火狐浏览器参与E-bet游戏！','ie_version','faqdownload.htm');
			});
		}
	}
	//账号密码注册方法
	var register = {
		//入口
		init: function (submit_btn) {
			var loginname = $("#loginname").val();
			var psw = $("#passwordfield").val();
			// var register_code = $("#register_code").val();
			var roundedOne = $("#roundedOne").is(':checked');
			var recommend_code = $("#recommendCode").val();
			var _this = $(submit_btn);

			if (_this.hasClass('disable')) {
				return;
			}

			$.when(validModule.checkaccountname({val: loginname, validtype: 'reg'})).done(function (data1) {
				if (!data1 == 2) {
					return;
				} else if (!validModule.checkpassword({val: psw})) {
					return;
				}else if (!validModule.agree({val: $("#roundedOne").is(':checked')})) {
					return;
				} else {
					_this.addClass('disable');
					register.submit_register(_this);
				}
			});
		},
		//提交注册(ajax)
		submit_register: function (submit_btn) {
			var btn = $(submit_btn);
			tool.ajax({
				type: 'POST',
				url: "register.htm",
				data: tool.getStringParams(decodeURIComponent($('#registerForm').serialize())),
				controlBtn: btn,
				success: function (data) {
					// 不同状态的处理
					// 注册成功
					if (data.isRegisterSucc == 1) {
						if (data.hb == "true") {
							window.location.href = "userregSuccess.htm";
							return;
						}
						var gotohtml = $("#registerForm").attr('datafrom');
						if (gotohtml == 'registeruser') {
							window.location.href = "userregSuccess.htm";
							return;
						}
						window.location.href = "userregSuccess.htm";
					} else {
						// 注册失败
						if (data.message == '000000') {
							// prj.pop("I/O异常，注册失败！请稍后再试");
							$.dialog({
								html: "I/O异常，注册失败！请稍后再试",
								confirm: {
									callback: function () {
										window.location.reload();
									}
								}
							});
						} else if (data.message == '201726') {
							// jAlert('cccc',function(){
							//     window.location.href='';
							// });
							$.dialog({
								html: '同IP下一天之内人数超过上限,注册失败！',
								confirm: {
									callback: function () {
										window.location.reload();
									}
								}
							});
						} else {
							// prj.pop("注册失败，请联系在线客服");
							// jAlert("注册失败，请联系在线客服",'温馨提示');
							$.dialog({
								html: "注册失败，请联系在线客服",
								confirm: {
									callback: function () {
										window.location.reload();
									}
								}
							});
						}
					}
				},
				error: function (data) {
					$.dialog({
						html: "网络异常，请重试"
					});
					//请求出问题
					prj.btnloadingcancel(btn);
				}
			});
		}
	}
	//手机注册方法
	var phone_register = {
		//入口
		init: function (submit_btn) {
			var loginphoneVal = $("#loginphone").val();
			var phonecodeVal = $("#phone_code").val();
			var roundedTwo = $("#roundedTwo").is(':checked');
			var _this = $(submit_btn);
			if (_this.hasClass('disable')) {
				return;
			}
			//验证规则
			$.when(validModule.registphone({val: loginphoneVal, validtype: 'reg'})).done(function (data) {
				if (!data.isExist) {
					return;
				} else if (!validModule.agree({val: $("#roundedTwo").is(':checked')})) {
					return;
				} else {
					_this.addClass('disable');
					phone_register.submit_register(_this);
				}
			});
		},
		//提交注册(ajax)
		submit_register: function (submit_btn) {
			var btn = $(submit_btn);
			var val_phonecode = $("#phone_code").val();
			var params = {'action': 'smsRegUser', 'phone': $("#loginphone").val(), 'smsCode': $("#phone_code").val(),'token': $("#token").val()};
			tool.ajax({
				type: 'POST',
				url: "registeruser.htm", //注册接口
				data: params,
				controlBtn: btn,
				loadingtxt: '提交中',
				isAutoCancel: false,
				success: function (res) {
					//注册成功
					if (res.status == 1) {
						// $.dialog({
						// 	html:res.mes
						// })
						// prj.btnloadingcancel(btn);	
						window.location.href = "userregSuccess.htm";
					} else if (res.status == 0) {
						$.dialog({
							html: res.mes
						});
						$("#phone_code").val("");
						prj.btnloadingcancel(btn);
					}

				},
				error: function (res) {
					//请求出问题
					// prj.btnloadingcancel(btn);
				}
			});
		}
	}
	/*
	 工具方法
	 */
	var tool = {
		/*
		 method:只有秒的倒计时
		 params:
		 container:存放倒计时的容器
		 timeDiff:倒计时多少时间（传送的是秒）
		 prefix：倒计时文字前缀
		 callback：倒计时的回调函数
		 */
		simpleDowntime: function (obj) {
			//如果没有传这个参数，则不执行
			if (!(obj && obj.container)) {
				return;
			}
			var str = '',
					t = 0,
					endTimer = '',
					container = obj.container, //必传参数
					timeDiff = obj.timeDiff;
			prefix = obj.prefix ? obj.prefix : '',
					callback = obj.callback;

			endTimer = setInterval(function () {
				timeDiff = timeDiff - 1;
				if (timeDiff >= 0) {
					str = timeDiff + 's';
				} else {
					callback && typeof callback == 'function' && callback();
					str = '0s';
					clearInterval(endTimer);
					return;
				}
				if (container[0].tagName == 'INPUT') {
					container.val(prefix + '(' + str + ')');
				} else {
					container.html(prefix + str);
				}

			}, 1000);
		},
		/**
		 * 单例的方法，同一时间只能运行一次，除非触发了完成
		 */
		singleWay: (function () {

			var fgs = {},
					kit = {
						resolve: function (key) {
							fgs[key] = false;
						}
					};

			return function (key, func) {
				if (fgs[key] === true) {
					return;
				} else {
					fgs[key] = true;
					func.call(kit, key);
				}
			}
		})(),
		/*
		 * **********************************************************************
		 * cookie扩展
		 * **********************************************************************
		 */
		cookie: function (name, value, options) {
			try {
				if (typeof value !== 'undefined') {
					options = options || {};
					if (!this.cookieDomain)
						this.cookieDomain = "";
					options.domain = options.domain || this.cookieDomain;
					if (value === null) {
						value = '';
						options = $.extend({}, options);
						options.expires = -1;
					}
					var expires = '';
					if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
						var date;
						if (typeof options.expires == 'number') {
							date = new Date();
							date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
						} else {
							date = options.expires;
						}
						expires = '; expires=' + date.toUTCString();
					}
					var path = '; path=/';
					var domain = options.domain ? '; domain=' + (options.domain) : '';
					var secure = options.secure ? '; secure' : '';
					document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
				} else {
					var cookieValue = null;
					if (document.cookie && document.cookie != '') {
						var cookies = document.cookie.split(';');
						for (var i = 0; i < cookies.length; i++) {
							var cookie = $.trim(cookies[i]);
							if (cookie.substring(0, name.length + 1) == (name + '=')) {
								cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
								break;
							}
						}
					}
					return cookieValue;
				}
			} catch (e) {
				// console.log(e);
			}
		},
		clearCookie: function () {
			var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
			if (keys) {
				for (var i = keys.length; i--; ) {
					this.cookie(keys[i], null);
				}
			}
		},
		/*
		 * **********************************************************************
		 * 
		 * json转换扩展
		 * 
		 * **********************************************************************
		 */
		toJSON: typeof JSON === 'object' && JSON.stringify ? JSON.stringify : function (o) {
			if (o === null) {
				return 'null';
			}

			var pairs, k, name, val,
					type = $.type(o);

			if (type === 'undefined') {
				return undefined;
			}

			if (type === 'number' || type === 'boolean') {
				return String(o);
			}
			if (type === 'string') {
				return this.quoteString(o);
			}
			if (typeof o.toJSON === 'function') {
				return this.toJSON(o.toJSON());
			}
			if (type === 'date') {
				var month = o.getUTCMonth() + 1,
						day = o.getUTCDate(),
						year = o.getUTCFullYear(),
						hours = o.getUTCHours(),
						minutes = o.getUTCMinutes(),
						seconds = o.getUTCSeconds(),
						milli = o.getUTCMilliseconds();

				if (month < 10) {
					month = '0' + month;
				}
				if (day < 10) {
					day = '0' + day;
				}
				if (hours < 10) {
					hours = '0' + hours;
				}
				if (minutes < 10) {
					minutes = '0' + minutes;
				}
				if (seconds < 10) {
					seconds = '0' + seconds;
				}
				if (milli < 100) {
					milli = '0' + milli;
				}
				if (milli < 10) {
					milli = '0' + milli;
				}
				return '"' + year + '-' + month + '-' + day + 'T' +
						hours + ':' + minutes + ':' + seconds +
						'.' + milli + 'Z"';
			}

			pairs = [];

			if ($.isArray(o)) {
				for (k = 0; k < o.length; k++) {
					pairs.push(this.toJSON(o[k]) || 'null');
				}
				return '[' + pairs.join(',') + ']';
			}

			if (typeof o === 'object') {
				for (k in o) {
					// Only include own properties,
					// Filter out inherited prototypes
					if (this.hasOwn.call(o, k)) {
						// Keys must be numerical or string. Skip others
						type = typeof k;
						if (type === 'number') {
							name = '"' + k + '"';
						} else if (type === 'string') {
							name = this.quoteString(k);
						} else {
							continue;
						}
						type = typeof o[k];
						if (type !== 'function' && type !== 'undefined') {
							val = this.toJSON(o[k]);
							pairs.push(name + ':' + val);
						}
					}
				}
				return '{' + pairs.join(',') + '}';
			}
		},
		evalJSON: function (str) {
			/*jshint evil: true */
			return eval('(' + str + ')');
		},
		quoteString: function (str) {
			if (str.match(this.escape)) {
				return '"' + str.replace(this.escape, function (a) {
					var c = this.meta[a];
					if (typeof c === 'string') {
						return c;
					}
					c = a.charCodeAt();
					return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
				}) + '"';
			}
			return '"' + str + '"';
		},
				/*
	   		功能：获取url上的所有参数(不能单独解析参数，必须是url上的参数)
	   		参数：
	   			params:
	   			url
	   		使用方法：
	   			http://10.9.13.133:8082/game.htm?name = '123'& school = '222'
	   			name = '123'& school = '222'
	   		返回值：json对象
	   			obj = {
					name:123,
					school:222
	   			}
    	*/
		getParams: function (_params) {
			var params = null;
			var obj = {};
			if (_params) {
				if(_params.indexOf('?')>-1){
					var urlArr = _params.split("?");
					params = urlArr[1];
				}else{
					params = _params;
				}
				if (params) {
					//有多个参数的情况
					if (params.indexOf("&") != -1) {
						params = params.split("&");
						$.each(params, function (i, val) {
							val = val.split("=");
							obj[val[0]] = val[1];
						});
					} else {
						//只有一个参数的情况
						params = params.split("=");
						obj[params[0]] = params[1];
					}
				}
			}
			return obj;
		},
		/*
        	功能：获取url上的某个参数
        */
		getUrlParam :function(key){
            var reg = new RegExp("(^|$)"+key+"=([^$]*)(&|$)");
            var name = window.location.search.substr(1).match(reg);
            if(name) {
            	return unescape(name[2]);
            }
            return null;
        },
		/*
	   		功能：获取隐藏域中的参数
	   		参数：
	   			selector:存放隐藏域的容器
	   		使用方法：
	   			<div id="js-local-hidden">这个selector自己写
					<input type="hidden" value="{{phone}}" name="phone"/>
	   			</div>
	   		返回值：json对象
	   		{phone:123}		
    	*/
	    getHiddenValues : function(selector){
			var res = {};
			var container = $(selector);
			container.find('input[type=hidden]').each(function(i, input){
				var $input = $(input);
				res[$input.attr('name')] = $input.val();
			});
			container.find('textarea').each(function(i, input){
				var $input = $(input);
				res[$input.attr('name')] = $.parseJSON($input.val());
			});
			return res;
		},
		/*
			功能：获取全站的配置参数
			备注：已经挂载在window下面了一个属性globalConfig，可以直接使用
		*/
		getglobalConfig:function(){
           var globalConfig = tool.getHiddenValues($('#js-global-hiddens'));
           window.globalConfig = globalConfig;
        },
        /*
			功能：获取当页的配置参数
			备注：已经挂载在window下面了一个属性globalConfig，可以直接使用
		*/
        getlocalConfig:function(){
           var localConfig = tool.getHiddenValues($('#js-local-hiddens'));
           return localConfig;
        },
		/*
		 功能：生成按钮上几个点的loading效果
		 
		 注意：
		 ①不能修改loadingpoint这个class，因为都是根据这个操作的
		 */
		loadingAnimation: function (container) {
			var loading = '<ul class="clearfix loadingpoint"><li class="active"></li><li></li><li></li><li></li><li></li></ul>';
			var loadingpoint = $(container).find('.loadingpoint');
			if(loadingpoint.length == 0){
				//需要先加入，再选择	
				$(container).append(loading);
			}
			var num = 0;
			var el = $('.loadingpoint li');
			setInterval(function () {
				num++;
				num %= $(el).length;
				$(el[num]).addClass('active').siblings('li').removeClass();
			}, 500);
		},
		//获取url上的参数
		getParams: function (url) {
			var obj = {};
			if (url) {
				var urlArr = url.split("?");
				var params = urlArr[1];
				if (params) {
					//有多个参数的情况
					if (params.indexOf("&") != -1) {
						params = params.split("&");
						$.each(params, function (i, val) {
							val = val.split("=");
							obj[val[0]] = val[1];
						});
					} else {
						//只有一个参数的情况
						params = params.split("=");
						obj[params[0]] = params[1];
					}
				}
			}
			return obj;
		},
		getStringParams: function (params) {
			var obj = {};
			if (params) {
				//有多个参数的情况
				if (params.indexOf("&") != -1) {
					params = params.split("&");
					$.each(params, function (i, val) {
						val = val.split("=");
						obj[val[0]] = val[1];
					});
				} else {
					//只有一个参数的情况
					params = params.split("=");
					obj[params[0]] = params[1];
				}
			}
			return obj;
		},
		//ajax提交封装
		ajax: function (options) {
			//设置参数默认值
			var url, data, cache_time, success, error, async, type, beforeSend, dataType, hasLoading, controlBtn, isAutoCancel, loadingtxt, loadingType;

			//ajax的type类型
			if (typeof options.type != "string") {
				type = 'post';
			} else {
				type = options.type;
			}
			//接口url
			if (typeof options.url != "string") {
				return false;
			} else {
				url = options.url;
			}
			//参数
			if (typeof options.data != "object") {
				data = {};
			} else {
				data = options.data;
			}
			//缓存时间
			if (typeof options.cache_time != "number") {
				cache_time = 0;
			} else {
				cache_time = options.cache_time;
			}
			//成功回调
			if (typeof options.success != "function") {
				success = function (backdata) {
				};
			} else {
				success = options.success;
			}
			//错误回调
			if (typeof options.error != "function") {
				error = function (backdata) {
				};
			} else {
				error = options.error;
			}
			//同步异步选择
			if (typeof options.async == "undefined") {
				async = true;
			} else {
				async = options.async;
			}
			//是否传了beforeSend事件
			if (typeof options.beforeSend != "function") {
				beforeSend = function (backdata) {};
			} else {
				beforeSend = options.beforeSend;
			}
			//是否需要loading
			if (typeof options.hasLoading != "boolean") {
				hasLoading = true;
			} else {
				hasLoading = options.hasLoading;
			}
			if (typeof options.dataType != "string") {
				dataType = 'json';
			} else {
				dataType = options.dataType;
			}
			//是否传过来了触发按钮
			if (typeof options.controlBtn != "undefined") {
				controlBtn = options.controlBtn;
				//loading上的文字
				loadingtxt = options.loadingtxt;
			} else {
				// controlBtn = $();
			}
			//是否自动去掉loading效果
			if (typeof options.isAutoCancel == "boolean") {
				isAutoCancel = options.isAutoCancel;
			} else {
				isAutoCancel = true;
			}
			//btnloading,loading(btnloading:按钮上的Loading，loading:页面loading)
			if (typeof options.loadingType != "undefined") {
				loadingType = options.loadingType;
			} else {
				loadingType = 'btnloading';
			}
			cache_time = cache_time * 1000;

			var postdata = {
				url: url,
				data: data
			};

			var that = this;
			try {
				this.callAjax(postdata, success, error, cache_time, async, type, hasLoading, controlBtn, isAutoCancel, loadingtxt, loadingType, dataType);
			} catch (e) {
				jAlert(e, '温馨提示');
			}
		},
		callAjax: function (postdata, success, error, cache_time, async, type, hasLoading, controlBtn, isAutoCancel, loadingtxt, loadingType, dataType) {
			//获取静态资源前缀
			var static_content_prefix = '';
			var _globalHiddens = $('#js-global-hiddens');
			if (prj.getHiddenValues(_globalHiddens)) {
				static_content_prefix = prj.getHiddenValues(_globalHiddens).static_content_prefix;
			}
			$.ajax({
				type: type,
				async: async,
				url: postdata.url, //"http://10.100.4.16/app/api",
				data: postdata.data,
				dataType: dataType,
				// timeout: 3000,
				success: function (data) {
					/**
					 * backdata格式为：
					 * {
					 * error:错误码[int,0或其他],
					 * msg:错误信息[string],
					 * content:接口正确内容，具体见接口文档，
					 * time:服务器时间[int],
					 * be_crowded:登录是否被挤出[0/1],
					 * token:用户标识[string(40)]
					 * }
					 */
					/*
					 回调后都执行这个公共语句：
					 去掉loading效果
					 */
					// if(isAutoCancel){
					// 	prj.btnloadingcancel(controlBtn);
					// }else{

					// }
					if (isAutoCancel) {
						if (controlBtn && loadingType == 'btnloading') {
							prj.btnloadingcancel(controlBtn);
						} else {
							prj.loadingcancel();
						}
					}
					success(data);
				},
				error: function (xhr, errorType, errorThrown) {
					/*
					 回调后都执行这个公共语句：
					 去掉loading效果
					 */
					if (isAutoCancel) {
						if (controlBtn && loadingType == 'btnloading') {
							prj.btnloadingcancel(controlBtn);
						} else {
							prj.loadingcancel();
						}
					}
					error(xhr);
				},
				beforeSend: function () {
					if (hasLoading) {
						if (controlBtn && loadingType == 'btnloading') {
							prj.btnloading(controlBtn, loadingtxt);
						} else {
							prj.loading(static_content_prefix + '/_default/__static/__images/load-f1.gif');
						}
					}

				}
			});
		},
		//表单提交
		submitForm: function (form) {
			var static_content_prefix = '';
			var _globalHiddens = $('#js-global-hiddens');
			if (prj.getHiddenValues(_globalHiddens)) {
				static_content_prefix = prj.getHiddenValues(_globalHiddens).static_content_prefix;
			}
			prj.loading(static_content_prefix + '/_default/__static/__images/load-f1.gif');
			$(form).submit();
		},
		/*
		 功能：生成不重复的随机账号
		 参数：
		 数组
		 demo:
		 var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
		 生成1-15之间的随机数
		 */
		rands: function (arr) {
			var n = Math.floor(Math.random() * arr.length + 1) - 1;
			var num = arr[n];
			arr.splice(n, 1);
			return num;
		},
		//设置全局电话号码
		setServicephoneNo:function(){
			var phonecont = $('.data-serviceNo');
			var servicephoneNoArr = [];
			// var servicephoneNoArr = ['021-51268676','021-51268677'];
			$.each(phonecont.children(),function(i,val){
				var globalphoneno = $(val).data('globalphoneno');
				if(globalphoneno == 0){
					$(val).html(servicephoneNoArr[globalphoneno]);
				}else if(globalphoneno == 1){
					$(val).html(servicephoneNoArr[globalphoneno]);
				}
			});
			if(servicephoneNoArr.length == 1){
				phonecont.show();	
			}else if(servicephoneNoArr.length == 2){
				phonecont.show();
			}else{
				phonecont.hide();
			}
		},
		/*
			功能：跳转到页面某个位置
			 locationel:跳转到页面的某个元素所在的位置
			 top:跳转到页面某个位置
			 clickel:若有点击元素，则给该元素添加点击事件
		*/
		scrollFn:function(options){
			var locallocationel = options.locationel;
			var localclickel = options.clickel;
			var localtop = options.top;
			if(localclickel){
				$(localclickel).on('click',function(){
					scrollTopFn(locallocationel,localtop);
				});
			}else{
				scrollTopFn(locallocationel,localtop);
			}
			function scrollTopFn(el,top){
				var localtop = 0;
				if(el){
					localtop = $(el).offset().top;
				}else{
					localtop = top?top:0;
				}
				//回到顶部
				$("body,html").animate({
					scrollTop:localtop +'px'
				},300);
			}
		},
		/*
			功能：给select标签添加选中值
			参数：
				①select元素
				②data:选中值
		*/
		setSelectoption:function(selectId,data){
			var defaultval = '';
			$(selectId).find('option:selected').val(data);
			if(data == '-1'){
				defaultval = $(selectId).find('option:selected').html();
				$(selectId).siblings(".txt_in").html(defaultval);
			}else{
				$(selectId).siblings(".txt_in").html(data);
			}
           
		}
	};

	global.tool = tool;
}(this, jQuery);

//init
;
!function (prj) {
	prj.init = function () {
		$('.float-btn-con').hover(function () {
			$('.float-content-con').show();
			$('.float-btn').hide();
		}, function () {
			$('.float-content-con').hide();
			$('.float-btn').show();
		});

		$(".txt_select").change(function () {
			$(this).parent().find(".txt_in").html($(this).find("option:selected").text());

			$(".txt_select").each(function () {
				if ($(this).children("option").length == 1) {
					$(this).parent().find(".txt_in").html($(this).find("option:selected").text());
				}
			});

		});
	}
}(prj);
//=============================================================
//  
//  功能：公共的一些简单动画效果
//  开发者：helen
//  开发时间：2017.04.19
//  最后修改时间：2017.04.19
//  备注：
//     做一个整理分类
//
//=============================================================
var publicAnimate = {
	commonInput:function(){
		//公共输入框方法
		$('input.regInp').val('');
		$('.regTips').on('click', function () {
			$(this).siblings('input.regInp').focus();
		});
		$('input.regInp').focus(function () {
			// $(this).siblings('.regTips').hide();
			// //这里适用于注册页面(更换背景色)
			// if ($(this).parent().hasClass('txt_div')) {
			// 	$(this).removeClass("onb").addClass("onf");
			// 	$(this).siblings("label").removeClass("onb").addClass("onf");
			// }
		});
		$('input.regInp').keyup(function(){
			$(this).siblings('.regTips').hide();
			//这里适用于注册页面(更换背景色)
			if ($(this).parent().hasClass('txt_div')) {
				$(this).removeClass("onb").addClass("onf");
				$(this).siblings("label").removeClass("onb").addClass("onf");
			}
		});
		$('input.regInp').blur(function () {
			var thisVal = $(this).val();
			if ($(this).parent().hasClass('txt_div')) {
				$(this).removeClass("onf").addClass("onb");
				$(this).siblings("label").removeClass("onf").addClass("onb");
			}
			if (thisVal) {
				$(this).next('.regTips').hide();
			} else {
				$(this).next('.regTips').show();
			}
		});
	}

}
$(document).ready(function () {


	prj.init();
	prj.ieEbet();

	hideMenu();
	slidBar();
	publicAnimate.commonInput();
	//winDisplay('.popregister', '#loginWin');
	winDisplay('#detailBtn', '.E03-detailWin');
	winDisplay('.washBtn', '.E03-washWin');
	// winDisplay('.applyBtn1', '.E03-applyWin1');
	// winDisplay('.applyBtn2', '.E03-applyWin2');
	// winDisplay('.applyBtn3', '.E03-applyWin3');
	winDisplay('.applyBtn4', '.E03-applyWin4');
	winDisplay('.applyBtn6', '.E03-applyWin6');//可申请复活礼金
	goTo();
	checkBoxText();
	//文字普通点击窗口以外的遮罩层 弹窗关闭
	winOutClose('#E03-displayWinBg', '#loginWin', '.close');
	//牌照页面查看大图
	winOutClose('.window-Mask', '#licenWindow', '.licenclose');
	winOutClose('#masktop', '.enter-visit-con', '#visitno');
	//登陆弹窗
	winOutClose('.import_window', '.login_window', 'a.btn_close');
	//推广弹窗
	winOutClose('.popup_window', '.popupBox', 'a.popup_close');


	// 阻止ie下随意按下回车按钮出发登陆事件
	$(document).keypress(function (e) {
		if (e.which == 13) {
			return false;
		}
	});

	$('.imgcode').click(function () {
		$('.code').trigger('click');
	});

	$('.img_code').click(function () {
		$('.code').trigger('click');
	});

	$('.popregister').click(function () {
		$('.img_code').trigger('click');
	});

	//loading条


	/*
	 全站公用的一些功能
	 */

	//点击遮罩层关闭jalert弹窗
	$(document).on('click', '#jalert_overlay', function () {
		$.alerts._hide();
	});
	//账号密码登录功能
	$(document).on('click', "#loginBtn", function () {
		prj.login();
	});
	//手机验证码登录功能
	$(document).on('click', "#phone_loginBtn", function () {
		prj.phone_login();
	});
	//注册功能
	//v2版本注册
	//账号注册
	$(document).on('click', '#regitser_submitBtn', function () {
		prj.register($(this));
	})
	//手机注册
	$(document).on('click', '#phregitser_submitBtn', function () {
		prj.phone_register($(this));
	});
	//手机登录时不存在的手号码直接注册
	$(document).on('click', '#transreg_submitBtn', function () {
		prj.newphone_register($(this));
	});
	//获取全站全局的服务电话
	tool.setServicephoneNo();
	//获取全站的配置文件(template.html中隐藏域中的内容)
	tool.getglobalConfig();

});


//*********ajax.js引入start***********//
function ParamsMap(paramsUrl) {
	this.hashMap = new Object();
	this.size = 0;
	if (paramsUrl) {
		var paramPairs = paramsUrl.split("&");
		for (var i = 0; i < paramPairs.length; i++) {
			var paramPair = paramPairs[i].split("=");
			this.put(paramPair[0], paramPair[1]);
			//alert("key==="+paramPair[0]+",val==="+paramPair[1]);
		}
	}
}

ParamsMap.prototype.put = function (paramName, paramValue) {
	var params = new ParamsEntry(paramName, paramValue);
	this.hashMap[paramName] = params;
	this.hashMap[this.size++] = params;
}

ParamsMap.prototype.get = function (paramName) {
	var params = this.hashMap[paramName];
	if (params)
		return params.getParamValue();
	else
		return null;
}

ParamsMap.prototype.toUrl = function () {
	var url = "?";
	for (var i = 0; i < this.size; i++) {
		var params = this.hashMap[i];
		url = url + params.getParamName() + "=" + escape(encodeURI(params.getParamValue())) + "&";
	}
	url = url + "dummy=" + (new Date().getTime());

	return url;
}

function ParamsEntry(paramName, paramValue) {
	this.paramName = paramName;
	this.paramValue = paramValue;
}

ParamsEntry.prototype.getParamName = function () {
	return this.paramName;
}

ParamsEntry.prototype.getParamValue = function () {
	return this.paramValue;
}


//创建试玩用户
function createdemo($captcha) {
	tool.ajax({
		type: 'POST',
		url: "dodemo.htm",
		data: {"demo": "true", 'captcha': $captcha},
		success: function (data) {
			if (data.status == 1) {
				window.location.href = "index.htm";
			} else if (data.status == 3) {
				prj.pop("验证码错误");
				prj.loadingcancel();
			} else {
				prj.pop("创建用户失败,请联系在线客服");
				prj.loadingcancel();
			}

		},
		error: function (data) {
			if (data.responseText.substr(0, 6) == '201726') {
				prj.pop("非常抱歉，相同IP下申请试玩次数已达到上限，请联系客服咨询");
			} else {
				prj.pop("非常抱歉，相同IP下申请试玩次数已达到上限，请联系客服咨询");
			}
			// console.log(data.responseText.substr(0,6));
			prj.loadingcancel();
		}
	});
}


function sendAjaxRequest(url, paramsObject, callFunction) {
	if (arguments[3] == undefined) {
		arguments[3] = true;
	}
	url = url + paramsObject.toUrl();
	$.ajax({
		type: 'GET',
		url: url,
		async: arguments[3],
		success: function (data) {
			callFunction(data);
		},
		error: function (data) {
			alert(data);
		}
	});
}
//*********ajax.js引入end***********//

/*peter头部二级菜单*/
function refreshCaptcha(img, captchaUrl) {
	var date = new Date();
	img.src = captchaUrl + "?t=" + date;
	img.style.display = "";
}

function hideMenu() {
	$("ul.menuBig #menuH1").mouseover(function () {
		var menuHflag = $(this).hasClass("active");
		if (!menuHflag) {
			$(this).find("a span").css("color", "#f8e1ae");
			$(this).mouseout(function (e) {
				$(this).find("a span").css("color", "#1d1829")
			});
		}
	});


	$(".videoButton").hover(function () {
		var hoverH = $(this).children(".videoHover"),
				hoverV = $(".hideVideo");
		$(this).add($(this).prev().find(".menuBtn")).children("span").css("border", "none");
		hoverH.stop(true);
		//hoverV.stop(true);
		hoverH.show();
		hoverV.show();
	},
			function () {
				var hoverH = $(this).children(".videoHover"),
						hoverV = $(".hideVideo");
				$(this).prev().find(".menuBtn").children("span").css("border-right", "1px solid #1d1829");
				hoverH.stop(true);
				//hoverV.stop(true);
				hoverH.hide();
				hoverV.hide();
			});
}

/*peter侧栏*/
function slidBar() {
	var WH = $(window).height();
	$('#slidBar').height(WH);
	$('#slidBar').children('div').hover(function () {
		$(this).find('.button').css({
			display: 'block'
		});
	},
			function () {
				var button = $(this).find('.button');
				button.stop(true);
				button.css({
					display: 'none'
				});
			})
}
;

/*peter弹出层*/

// function winDisplay (btn, winId){
// 	var win = $(winId),
// 		bwin = $(window),
// 		ww = win.width() / 2,
// 		wh = win.height() / 2,
// 		bww = bwin.width(),
// 		bwh = bwin.height(),
// 		nww = bww / 2 - ww,
// 		nwh = bwh / 2 - wh,
// 		winBg = $('#E03-displayWinBg'),
// 		close = win.find(".close"),
// 		closeBtn = win.find(".closeBtn");
// 	winBg.css({
// 		width: bww,
// 		height: bwh
// 	});
// 	$(btn).click(function() {
// 		win.css({
// 			left: nww,
// 			top: nwh
// 		});
// 		$(winId).removeClass('E03-none');
// 		winBg.removeClass('E03-none');
// 		close.click(function() {
// 			$(this).parents(winId).addClass('E03-none');
// 			winBg.addClass('E03-none');
// 		});
// 		closeBtn.click(function(){
// 			$(this).parents(winId).addClass('E03-none');
// 			winBg.addClass('E03-none');
// 		})
// 	})
// };




function playGame(dom) {
	$dom = $(dom);
	//真钱进游戏
	function loginGame($dom) {
		var $flag = $("#" + $dom.attr("attr-gameplat") + "flag").attr("attr-flag");
		if ($flag == "2") {
			prj.pop("游戏厅正在维护中！");
			return;
		}
		openWindow('loginslotgame.htm?gameId=' + $dom.attr("attr-gameid") + "?" + $dom.attr("attr-gameplat") + "?gameName=" + $dom.attr("attr-gamename"), 1024, 780);
		function openWindow(url, width, height) {
			var map = new ParamsMap();
			var result = undefined;
			var hasScroll = "yes";
			var param = "height=" + height + ", width=" + width + ", scrollbars= " + hasScroll + ",resizable=yes,toolbar=no,directories=no,menubar=no,locationbar=no,personalbar=no,statusbar=no";
			window.open(url, "_blank", param);
			/*sendAjaxRequest("checkLoginDetails.htm", map, function (results) {
				if (results.isLogin != "false") {
					var hasScroll = "yes";
					var param = "height=" + height + ", width=" + width + ", scrollbars= " + hasScroll + ",resizable=yes,toolbar=no,directories=no,menubar=no,locationbar=no,personalbar=no,statusbar=no";
					window.open(url, "_blank", param);
				} else {
					prj.pop("尊敬的会员，您的登陆已超时，请您重新登陆！", "4", '', 6, 'index.htm');
				}
			}, false);*/
		}
	}

	//游客 进入游戏
	function visitGame($dom) {
		var $flag = $("#" + $dom.attr("attr-gameplat") + "flag").attr("attr-flag");
		if ($flag == "2") {
			prj.pop("游戏厅正在维护中！");
			return;
		}
		// if ($dom.attr("attr-gameid") == "6" && $dom.attr("attr-gameplat") == "AG") {
		// 	window.location.href = "fishpot.htm";
		// 	return;
		// }
		openWindow('visitslotgame.htm?gameId=' + $dom.attr("attr-gameid") + "?" + $dom.attr("attr-gameplat") + "?gameName=" + $dom.attr("attr-gamename"), 1024, 780);
		function openWindow(url, width, height) {
			var hasScroll = "yes";
			var param = "height=" + height + ", width=" + width + ", scrollbars= " + hasScroll + ",resizable=yes,toolbar=no,directories=no,menubar=no,locationbar=no,personalbar=no,statusbar=no";
			window.open(url, "_blank", param);
		}
	}

	//判断会员种类
	if ($("#checklogin").attr("attr-type") == "1") {//真钱
		loginGame($dom);
	}else {//其他试玩
		visitGame($dom);
	}
}
;
//公共滚动方法
function goTo() {
	function go(num) {
		$("html, body").stop(true);
		$("html, body").animate({
			scrollTop: num
		}, 'fast');
	}
	$('#comeBack').click(function () {
		go(0);
	});
}
function logoMove() {
	$('.logo').stop(true);
	$('.logo').animate({
		top: '-67px'
	},
			'fast', changeLogoSmall()
			)
}
//体验金隐藏文字方法
function checkBoxText() {
	$(".hideText").click(function () {
		if ($(this).attr("checked") == "checked") {
			$(this).parents(".checkBoxGrp").next(".noticTxt").css("display", "block");
		} else {
			$(this).parents(".checkBoxGrp").next(".noticTxt").css("display", "none");
		}
	})
}
function changeLogoSmall() {
	var url = $("#E03-header").attr("data-url");
	$(".logo").find("img").attr("src", url + "LOGO_S-normal.jpg").css("margin-top", "77px");
}
function changeLogoBig() {
	var url = $("#E03-header").attr("data-url");
	$(".logo").find("img").attr("src", url + "inx-logo-normal.jpg").css("margin-top", "20px");
}
function logoMoveDown() {
	$('.logo').stop(true);
	$('.logo').animate({
		top: '0px'
	}, 'fast', changeLogoBig());
}

function showAll(url) {
	window.open(url, '', 'width=' + (window.screen.availWidth - 10) + ',height=' + (window.screen.availHeight - 30) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
}

$(window).scroll(function () {
	var wh = $(window).scrollTop();
	if (wh == 0) {
		logoMoveDown();
	}
	if (wh > "0") {
		logoMove();
	}
});
//点击弹窗外部任意区域关闭本弹窗
function winOutClose(winOutMask, winWin, closeTrigger) {
	var num_child = $(winWin).find(closeTrigger).length;
	if (num_child > 0) {
		$(winOutMask).bind("click", function () {
			$(closeTrigger).trigger("click");
		})
	}
}
function numberOnly(e) {
	if (window.event) { // Internet Explorer
		var keyCode = window.event.keyCode;

		return (keyCode >= 48 && keyCode <= 57);
	} else { // Mozilla
		var keyCode = e.which;

		return (keyCode >= 48 && keyCode <= 57) || keyCode == 0
				|| keyCode == 8; // allow backspace and delete
	}
}


$(window).resize(function () {
	//winDisplay('.popregister', '#loginWin');
	winDisplay('#detailBtn', '.E03-detailWin');
	slidBar();
});

/*peter弹出层*/
function winDisplay(btn, winId) {
	var win = $(winId),
			bwin = $(window),
			ww = win.width() / 2,
			wh = win.height() / 2,
			bww = bwin.width(),
			bwh = bwin.height(),
			nww = bww / 2 - ww,
			nwh = bwh / 2 - wh,
			winBg = $('#masktop'),
			close = win.find(".close"),
			closeBtn = win.find(".closeBtn");
	winBg.css({
		width: bww,
		height: bwh
	});
	$(btn).click(function () {
		win.css({
			left: nww,
			top: nwh
		});
		// console.log(ww +'**********---------***********'+wh);
		$(winId).removeClass('E03-none');
		winBg.show();
		close.click(function () {
			$(this).parents(winId).addClass('E03-none');
			winBg.hide();
		});
		closeBtn.click(function () {
			$(this).parents(winId).addClass('E03-none');
			winBg.hide();
		})
	})
}
;

